<?php ob_start();
include("config/config.php"); 
if(isset($_REQUEST['session'])&&($_REQUEST['session']==1)){$_SESSION['id']=1;}

if(isset($_REQUEST['cat'])&&($_REQUEST['cat']!='')){$_SESSION['cat_id']=$_REQUEST['cat'];}  

if(isset($_REQUEST['business_url'])){
	$_SESSION['business_url']=$_REQUEST['business_url'];
	if(isset($_SESSION['id'])){
		echo 1;
	}
}

if(isset($_REQUEST['status'])){
	$sql=mysql_query("UPDATE `my_business_url` SET `status`='".$_REQUEST['status']."' WHERE `id`='".$_SESSION['url_id']."'  ")or die(mysql_error());
	if($sql){echo $_REQUEST['status'];}
}
if(isset($_REQUEST['gallery_title'])){
	$sql=mysql_query("UPDATE `my_business_url` SET `gallery_title`='".$_REQUEST['gallery_title']."' WHERE `id`='".$_SESSION['urlid']."'  ")or die(mysql_error());
	if($sql){echo 1;}
}
if(isset($_REQUEST['deleteimg'])){//echo 1;
	$x=mysql_fetch_array(mysql_query("SELECT * FROM `my_images` WHERE `id` = '".$_REQUEST['deleteimg']."' "));
	unlink("uploads/".$x['image']);
	unlink("uploads/thumbs/t_".$x['image']);
	$sql=mysql_query("DELETE FROM `my_images` WHERE `id` = '".$_REQUEST['deleteimg']."'")or die(mysql_error());
	//if($sql){echo 1;}
}
if(isset($_REQUEST['showurl'])){
	$sql=mysql_query("SELECT * FROM `my_business_url` WHERE `id`='".$_REQUEST['showurl']."'  ")or die(mysql_error());
	if(mysql_num_rows($sql)){ $result=mysql_fetch_array($sql); echo $result['url'];}
}

if(isset($_REQUEST['alt_txt'])&&($_REQUEST['alt_txt']!="")){
	$sql=mysql_query("UPDATE `my_images` SET `alt_text`='".$_REQUEST['alt_txt']."' WHERE `id`='".$_REQUEST['id']."'  ")or die(mysql_error());
	if($sql){echo 1;}
}




if (isset($_REQUEST['url'])){ // print_r($_REQUEST);
	$sql=mysql_query("SELECT * FROM `my_business_url` WHERE `url`='".$_REQUEST['url']."'  ")or die(mysql_error());
	$result=mysql_fetch_array($sql);
	if(mysql_num_rows($sql)){  echo 1; }else{
		$sql2=mysql_query("UPDATE `my_business_url` SET `url`='".$_REQUEST['url']."' WHERE `id`='".$_REQUEST['urlid']."'  ")or die(mysql_error());
		if($sql2){echo "0";}
	}
} 



//check username///////////////////////
if(isset($_REQUEST['display'])&&($_REQUEST['display']!="")) { //print_r($_REQUEST);
	$emp_sql=mysql_query("SELECT `url` FROM `my_business_url` WHERE `url`='".mysql_real_escape_string($_REQUEST['display'])."' ");
	if(mysql_num_rows($emp_sql)) {
		echo 1;
		//echo "Please Use another Email ID,This Email already used.";	
	}else{
		echo 0;
		//echo "Email Id available tu use";  
	}
}
////////////////////////////////////////


?>
